Skip to content

making the external authorizers consume the user-defined properties from the entity attribute#5032

Open
iprithv wants to merge 1 commit into
apache:mainfrom
iprithv:fix/polaris-principal-user-defined-properties
Open

making the external authorizers consume the user-defined properties from the entity attribute#5032
iprithv wants to merge 1 commit into
apache:mainfrom
iprithv:fix/polaris-principal-user-defined-properties

Conversation

@iprithv

@iprithv iprithv commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

follow-up Dmitri mentioned in #5085: after the PolarisPrincipal generic-attributes refactor, forward user-defined principal properties to OPA and Ranger authorizers so the behavior from the earlier #5032 approach is preserved without merging properties into PolarisPrincipal itself.

PR #4405 originally proposed merging user-defined properties directly into PolarisPrincipal. The dev-list discussion concluded that PolarisPrincipal should stay decoupled from PrincipalEntity, and PR #5085 introduced generic attributes to expose the entity as an optional attribute. This PR completes that direction by making the external authorizers consume the user-defined properties from the entity attribute.

@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Jul 10, 2026
@iprithv iprithv closed this Jul 10, 2026
@github-project-automation github-project-automation Bot moved this from PRs In Progress to Done in Basic Kanban Board Jul 10, 2026
@iprithv iprithv changed the title DefaultAuthenticator forwards user-defined principal properties for ABAC authorizers Add atomic multi-entity and grant-record commit SPI Jul 10, 2026
@iprithv iprithv reopened this Jul 10, 2026
@github-project-automation github-project-automation Bot moved this from Done to PRs In Progress in Basic Kanban Board Jul 10, 2026
@iprithv
iprithv force-pushed the fix/polaris-principal-user-defined-properties branch from ee0c065 to d729092 Compare July 10, 2026 21:51
@iprithv iprithv closed this Jul 10, 2026
@iprithv
iprithv deleted the fix/polaris-principal-user-defined-properties branch July 10, 2026 23:05
@github-project-automation github-project-automation Bot moved this from PRs In Progress to Done in Basic Kanban Board Jul 10, 2026
@iprithv iprithv reopened this Jul 10, 2026
@github-project-automation github-project-automation Bot moved this from Done to PRs In Progress in Basic Kanban Board Jul 10, 2026
@iprithv
iprithv marked this pull request as draft July 10, 2026 23:12
@iprithv iprithv closed this Jul 10, 2026
@github-project-automation github-project-automation Bot moved this from PRs In Progress to Done in Basic Kanban Board Jul 10, 2026
@iprithv iprithv reopened this Jul 16, 2026
@github-project-automation github-project-automation Bot moved this from Done to PRs In Progress in Basic Kanban Board Jul 16, 2026
@iprithv
iprithv force-pushed the fix/polaris-principal-user-defined-properties branch from d729092 to ff0aba7 Compare July 16, 2026 21:42
@iprithv iprithv changed the title Add atomic multi-entity and grant-record commit SPI Include user-defined attributes when building PolarisPrincipal from PrincipalEntity Jul 16, 2026
@iprithv
iprithv marked this pull request as ready for review July 16, 2026 22:33
@dimas-b

dimas-b commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@iprithv : Please rebase to get compilation fixes from main

dimas-b
dimas-b previously approved these changes Jul 16, 2026
Comment thread CHANGELOG.md Outdated

### Fixes
- Fixed native catalog credential vending paths (`loadCredentials` and `loadTable` with delegation) to re-validate locations against the *current* catalog `allowedLocations`. Previously these paths trusted persisted table entity locations, allowing stale credentials after an admin tightened allowed locations on a native catalog. (The federated path had a partial check.)
- Fixed `PolarisPrincipal` construction from a `PrincipalEntity` to expose the principal's user-defined properties (alongside internal properties) so external authorizers such as OPA and Ranger can use them for policy evaluation. Internal properties win on key collision so that system-managed values such as `client_id` cannot be shadowed by user input.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd put this under "changes". Old behaviour was not a "bug" 😉

@github-project-automation github-project-automation Bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jul 16, 2026
@dimas-b

dimas-b commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

FYI: @cccs-cat001 @tokoko @sneethiraj

@dimas-b
dimas-b requested a review from adutra July 16, 2026 23:01
@iprithv
iprithv force-pushed the fix/polaris-principal-user-defined-properties branch from ff0aba7 to a245fbb Compare July 16, 2026 23:08
dimas-b
dimas-b previously approved these changes Jul 16, 2026
@dimas-b

dimas-b commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

#5085 proposes a more fundamental refactoring, which should support this use case too.

@adutra

adutra commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@iprithv I am proposing #5085 as an alternative to this PR. I am a little concerned by the fact that this PR merges together user-facing and internal properties. It also does not allow for generic attributes to be set on the principal. Let me know what you think. Thanks!

@dimas-b
dimas-b dismissed their stale review July 17, 2026 14:50

removing approval based on feedback from @adutra

* collision the internal value wins, so that system-managed properties (for example {@code
* client_id}) cannot be shadowed by user-supplied properties.
*/
private static Map<String, String> mergeEntityProperties(PrincipalEntity principalEntity) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the PrincipalEntity -> PolarisPrincipal property merge that the dev list moved away from (PR #4405 thread, Jul 7-11). The agreed direction is for the auth layer to forward user info to PolarisPrincipal as optional attributes, keeping PolarisPrincipal decoupled from PrincipalEntity (federated/detached principals may have no entity). It also only fires on the DefaultAuthenticator path -- a pluggable authenticator with no PrincipalEntity won't forward these. Is this still the intended mechanism, or superseded by the rework you described on the list?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah right, I removed the original mergeEntityProperties approach and followed the direction from the dev-list thread and #5085: PolarisPrincipal stays decoupled from PrincipalEntity, and user info is forwarded via the optional PolarisPrincipal.PRINCIPAL_ENTITY_ATTRIBUTE_KEY.

OPA and Ranger authorizers read user-defined properties from that attribute when available, merging them with internal properties (internal wins on collision) locally in the authorizer. This keeps PolarisPrincipal unchanged and doesn't require a backing entity for all principals. For pluggable authenticators that don't attach the entity attribute, the authorizers just see no extra attributes, which matches the dev-list consensus. Thanks!

@iprithv
iprithv force-pushed the fix/polaris-principal-user-defined-properties branch from a245fbb to 2085d35 Compare July 22, 2026 20:54
@iprithv
iprithv requested review from dimas-b and flyrain July 22, 2026 20:58
@iprithv iprithv changed the title Include user-defined attributes when building PolarisPrincipal from PrincipalEntity making the external authorizers consume the user-defined properties from the entity attribute Jul 22, 2026
@iprithv
iprithv force-pushed the fix/polaris-principal-user-defined-properties branch from 2085d35 to 590dbfc Compare July 22, 2026 21:24
@flyrain

flyrain commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Thanks @iprithv for working on it. Posted my concern in this thread, https://lists.apache.org/thread/blvxzb2x1ccn8jqvm9dcn2xw88nn2jmb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants